﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using API_Service.BizLogic.WipLogApi;
using Nancy;
using Newtonsoft.Json;

namespace API_Service.Module
{
    public class WipLogModule: BaseAPIModule
    {

        private WipLogService wiplogService = new WipLogService();

        public WipLogModule() : base("/wiplog")
        {
            Get["/"] = _ => Response.AsJson("wiplog module");

            #region wiplog insert API

            Post["/wiplog/addlog"] = _ =>
            {
                string model = (string)Request.Form["MODEL"];

                //dynamic vm = JsonConvert.DeserializeObject<dynamic>(model);

                ExecutionResult result = wiplogService.AddWipLog(model);

                return Response.AsJson(result);
            };

            #endregion

            Post["/select"] = _ =>
            {
                string model = (string)Request.Form["MODEL"];

                //dynamic vm = JsonConvert.DeserializeObject<dynamic>(model);

                ExecutionResult<dynamic> result = wiplogService.QuerySNWIPLogInfo(model);

                return Response.AsJson(result);
            };

        }



    }
}